<?php

namespace app\api\controller\user;

use app\api\controller\Controller;
use app\common\service\WxService;

/**
 * 用户二维码
 */
class Qrcode extends Controller
{
    public function wx_qrcode()
    {
        $user = $this->getUser();
        $service = new WxService($this->app_id);
        $qrcode = $service->getQrCode($user->user_id);
        if ($qrcode) {
            return $this->renderSuccess("", compact('qrcode'));
        } else {
            return $this->renderError("二维码获取失败");
        }
    }
}